package com.example.wssapp;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.view.View;

public class MainActivity extends Activity implements View.OnClickListener {

	private Button button;
	private Button mediaButton;
	// nine patch
	private Button ninePatchButton;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		button = (Button) findViewById(R.id.btn1);
		mediaButton = (Button) findViewById(R.id.media_button);
		ninePatchButton = (Button)findViewById(R.id.nine_patch_button);
		
		button.setOnClickListener(this);
		mediaButton.setOnClickListener(this);
		ninePatchButton.setOnClickListener(this);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}

	@Override
	public void onClick(View v) {
		Intent intent = new Intent();
		if (v.getId() == R.id.btn1) { // 是按钮的点击事件

			// intent.setClass(this, EventActivity.class);
			// intent.setClass(this, MenuBaActivity.class);
			intent.setClass(this, ContractsActivity.class);

		} else if (v.getId() == R.id.media_button) {
			// 多媒体demo
			intent.setClass(this, MediaActivity.class);
		} else if(v.getId() == R.id.nine_patch_button) {
			intent.setClass(this, PatchActivity.class);
		}
		startActivity(intent);
	}
}
